/******************************************************************************
 **
 **    LISA Confidential
 **
 **    Source Materials
 **
 **    (C) COPYRIGHT LISA 2008
 **
 **
 **  File Name:      RequesterAssignmentHandler.java
 **  Description:    Sets the requester to the requester swimlane.
 **  Date:           2008-10-26
 **  Author:         LisaQian
 ******************************************************************************/
package com.ti.andon.workflow.assignment;

import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.taskmgmt.def.AssignmentHandler;
import org.jbpm.taskmgmt.exe.Assignable;

import com.ti.andon.workflow.WFConstants;

public class RequesterAssignmentHandler implements AssignmentHandler{
	/**
	 * Serial Version ID.
	 */
	private static final long serialVersionUID = 4729151796529284279L;

	/* (non-Javadoc)
	 * @see org.jbpm.taskmgmt.def.AssignmentHandler#assign(org.jbpm.taskmgmt.exe.Assignable, org.jbpm.graph.exe.ExecutionContext)
	 */
	public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception
	{
		Long actorId = ((Long) executionContext.getContextInstance().getVariable(WFConstants.REQUESTER));
		if (actorId != null)
		{
			assignable.setActorId(actorId.toString());
		}
	}

}
